﻿<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<link rel="STYLESHEET" type="text/css" id="SkinStyleSheet">
<title></title>
<style>
#selectAnchor{
	width:150px;
}
</style>
<script language="javascript" type="text/javascript" src="../script/windialog.js"></script>
<script language="javascript" type="text/javascript">
window.onload=function()
{
	switch(srcObj.tagName)
	{
		case "A":case "oval": case "DIV":
		{
			break;
		}
		default:
		{
			if (EditorWindow.$browser.isIE)
			{
				alert("error arguments");
				window.returnValue=false;
				window.close();
				return;

			}
			else
			{
				
			}
		}
	}


	EditorWindow.renderWindowAsIE(window);
	
	var selTarget=new EditorWindow._HTMLselect("selectAreaTarget",document);
	var targetOptions = new Array(
		new Array("", EditorWindow.lang_form_target),
		new Array("_self", EditorWindow.lang_target_self), 
		new Array("_blank", EditorWindow.lang_target_blank),
		new Array("_top", EditorWindow.lang_target_top),
		new Array("_parent", EditorWindow.lang_target_parent)
	);
	selTarget.addOptions(targetOptions);
	if (srcObj.tagName=="A" || srcObj.tagName=="DIV" || srcObj.tagName=="oval")
		selTarget.focusOption(srcObj.target,document);
	selTarget=null;
		
	var selAnchor=new EditorWindow._HTMLselect("selectAnchor",document);
	var i,elems;
	elems=XEditor.document.getElementsByTagName("a");
	selAnchor.addOption("","");
	
	for (i=0;i<elems.length;i++)
	{
		if (elems[i].name!="")
		{
			selAnchor.addOption("#"+elems[i].name,elems[i].name,document);
		}
	}
	elems=null;
	
	document.getElementById("selectAnchor").onchange=selAnchor_onchange;

	if (srcObj.tagName=="A" || srcObj.tagName=="DIV" || srcObj.tagName=="oval")
	{
		var url=srcObj.href.toString().replace(EditorWindow.location,"");
		if (url.indexOf("#")==0)
		{
			selAnchor.focusOption(url,document);
			selAnchor_onchange();
		}
		else
		{
			document.getElementById("AreaHREF").value=url;
		}
		selAnchor=null;
	}
	AutoResizeDialogWindow();
}

function __btnOk_onclick()
{
	if (EditorWindow.$browser.isIE || srcObj.tagName=="A")
	{
		srcObj.setAttribute("href",document.getElementById("AreaHREF").value);
		if (document.getElementById("selectAreaTarget").value=="")
			srcObj.removeAttribute("target",true);
		else
			srcObj.setAttribute("target",document.getElementById("selectAreaTarget").value);
		if (document.getElementById("AreaHREF").value!="")
			window.returnValue=true;
		else
			window.returnValue=false;
	}
	else
	{
		XEditor.document.execCommand("CreateLink",false,document.getElementById("AreaHREF").value);
		
	}
	
	window.close();
}


function __btnCancel_onclick()
{
	window.close();
}

function selAnchor_onchange()
{
	document.getElementById("AreaHREF").value=document.getElementById("selectAnchor").value;
}

</script>
</head>
<body class="dialog">
<script language="javascript" type="text/javascript">dialogTitle("lang_attribute_link");</script>

<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><script language="javascript" type="text/javascript">dialogPrintlang("lang_anchor");</script></td>
    <td><select id="selectAnchor"></select></td>
  </tr>
  <tr>
    <td><script language="javascript" type="text/javascript">dialogPrintlang("lang_url");</script></td>
    <td><input type="text" id="AreaHREF" size="80" class="dialogInput"></td>
  </tr>
  <tr>
    <td><script language="javascript" type="text/javascript">dialogPrintlang("lang_form_target");</script></td>
    <td><select id="selectAreaTarget"></select></td>
  </tr>
</table>
<div class="buttons">
	<hr size="1" color="#B3AC9D">
	<script language="javascript" type="text/javascript">
		PrintButtons2();
	</script>
</div>

</body>

</html>
